import java.io.IOException;
import java.util.HashMap;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 周斌
 * Date: 2024-07-06
 * Time: 22:49
 */
public class tcpDictServer extends tcpEchoServer{
    HashMap<String,String> map = null;
    public tcpDictServer(int port) throws IOException {
        super(port);
        map = new HashMap<>();
        map.put("server","服务\n");
        map.put("client","客户端\n");
        map.put("cat","🐱\n");
        map.put("dog","🐕\n");
        map.put("pig","🐖\n");
    }

    @Override
    public String process(String request) {
        return map.getOrDefault(request,"该词汇没有查询到");
    }

    public static void main(String[] args) throws IOException {
        tcpDictServer tcpDictServer = new tcpDictServer(9999);
        tcpDictServer.start();
    }
}
